<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改店铺预订单')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-storeOrder-edit" th:object="${zsyhStoreOrder}">
            <h4 class="form-header h4">店铺预订单信息</h4>
            <input id="orderId" name="id" th:field="*{id}" type="hidden">
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">下单店铺：</label>
                        <div class="col-sm-8">
                            <p name="storeName" style="border-width: 0px;padding:6px 4px;" class="form-control" type="text">[[*{storeName}]]</p>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">状态：</label>
                        <div class="col-sm-8">
                            <select id="orderState" name="orderState" style="border: 0;appearance:none;background: transparent;" class="form-control m-b" th:with="type=${@dict.getType('agent_order_state')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{orderState}"></option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">收货人：</label>
                        <div class="col-sm-8">
                            <p name="orderName" style="border-width: 0px;padding:6px 4px;" class="form-control" type="text">[[*{orderName}]]</p>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">收货电话：</label>
                        <div class="col-sm-8">
                            <p name="orderPhone" style="border-width: 0px;padding:6px 4px;" class="form-control" type="text">[[*{orderPhone}]]</p>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">详细地址：</label>
                        <div class="col-sm-8">
                            <p name="orderAddress" style="border-width: 0px;padding:6px 4px;" class="form-control" type="text">[[*{orderAddress}]]</p>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">所属大区：</label>
                        <div class="col-sm-8">
                            <p name="agentName" style="border-width: 0px;padding:6px 4px;" class="form-control" type="text">[[*{agentName}]]</p>
                        </div>
                    </div>
                </div>
            </div>
            <h4 class="form-header h4">店铺预订单详细信息</h4>
            <div class="row">
                <div class="col-sm-12">
                    <!--<button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i></button>
                    <button type="button" class="btn btn-white btn-sm" onclick="sub.delColumn()"><i class="fa fa-minus"> 删除</i></button>-->
                    <div class="col-sm-12 select-table table-striped">
                        <table id="bootstrap-table"></table>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "zsyh/storeOrder";
        var isPlatformDatas = [[${@dict.getType('attribute_type')}]];
        $("#form-storeOrder-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-storeOrder-edit').serialize());
            }
        }

        $(function() {
            var options = {
                url: ctx + "zsyh/storeOrderRel/list?orderId="+$("#orderId").val(),
                pagination: false,
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                sidePagination: "client",
                columns: [
                {
                    field: 'index',
                    align: 'center',
                    title: "序号",
                    formatter: function (value, row, index) {
                    	var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
                    	return columnIndex + $.table.serialNumber(index);
                    }
                },
                    {
                        field: 'attributeLogo',
                        align: 'center',
                        title: '产品图',
                        formatter: function (value, row, index) {
                            return $.table.imageView(value);
                        }
                    },
                {
                    field: 'attributeName',
                    align: 'center',
                    title: '规格名称'
				},
                {
                    field: 'orderCount',
                    align: 'center',
                    title: '预订数量'
				},
                {
                    field: 'orderPrice',
                    align: 'center',
                    title: '单价'
				},
                {
                    field: 'isPlatform',
                    align: 'center',
                    title: '产品来源',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(isPlatformDatas, value);
                    }
                },
                {
                    field: 'createTime',
                    align: 'center',
                    title: '创建时间'
				}]
            };
            $.table.init(options);
        });

        $(function () {
            $('#orderState').attr("disabled",true);
        })

    </script>
</body>
</html>